<template>
  <el-container>
    <el-aside width="200px">
      <el-menu
        :default-active="activeMenu"
        class="customer-sidebar"
        background-color="#fff"
        @select="handleMenuSelect"
      >
        <el-menu-item index="customer-list">
          <i class="el-icon-user"></i>
          <span>客户列表</span>
        </el-menu-item>

      </el-menu>
    </el-aside>
    <el-main>
      <router-view></router-view>
    </el-main>
  </el-container>
</template>

<script>
export default {
  name: 'CustomerManagement',
  data() {
    return {
      activeMenu: 'customer-list'
    }
  },
  methods: {
    handleMenuSelect(index) {
      // 根据选择的菜单项进行路由导航
      this.$router.push(`/customer/${index}`).catch(err => {
        if (err.name !== 'NavigationDuplicated') {
          throw err;
        }
      });
    }
  }
}
</script>

<style scoped>
.el-aside {
  background-color: #fff;
  border-right: 1px solid #e6e6e6;
}

.customer-sidebar {
  height: 100%;
}

.el-menu-item {
  font-size: 14px;
}

.el-menu-item [class^="el-icon-"] {
  margin-right: 5px;
  width: 24px;
  text-align: center;
  font-size: 18px;
}
</style> 